home *** CD-ROM | disk | FTP | other *** search
/ Amoszine PD Edition 0 / Amoszine PD Edition 0.adf / SOURCE_CODE / Cool_text.AMOS / Cool_text.amosSourceCode
AMOS Source Code  |  1993-09-09  |  8KB  |  265 lines

  1. 'This a program I never reallty finished properly
  2. 'OK it's badly written but there may be a few useful routines
  3. 'in there! If you add more options and can get it to work when 
  4. 'compiled (it crashes on me, think its because of the RAM DISK)
  5. 'then send me a copy please  
  6. '================================================================
  7. Set Buffer 200
  8. If Not Exist("RAM:") Then Print "no ram: disk" : Wait Key 
  9. Close Editor 
  10. Screen Open 0,640,256,16,Hires : Curs Off : Paper 0 : Cls 0
  11. Colour 19,$111 : Colour 18,$EEE : Colour 17,$BBB
  12. Global A$,F$,BL,BS,FL,K$,A$,LIN,KK,B$
  13. FL=0
  14. '==================================
  15. MEN:
  16. Reserve Zone 16 : Paper 0 : Pen 5 : Cls 0
  17. Draw 0,165 To 640,165
  18. Draw 0,177 To 640,177
  19. '
  20. Draw 0,181 To 640,181
  21. Draw 0,193 To 640,193
  22. '
  23. Draw 0,197 To 640,197
  24. Draw 0,209 To 640,209
  25. Locate 0,0 : Pen 12 : Under On : Centre "COOL TEXT V1.0 By StEvE ByE (Mar 94)" : Under Off 
  26. Pen 5
  27. Locate 27,6 : Print Border$(Zone$("LOAD",1),1)
  28. Pen 14
  29. Locate 33,6 : Print Border$(Zone$("SAVE",13),1)
  30. Pen 4
  31. Locate 51,6 : Print Border$(Zone$("EXIT",5),1)
  32. Pen 1
  33. Locate 45,6 : Print Border$(Zone$("HELP",7),1)
  34. Pen 8
  35. Locate 39,6 : Print Border$(Zone$("VIEW",12),1)
  36. '
  37. '
  38. Pen 15
  39. Locate 22,3 : Print Border$(Zone$("CLEAN",4),1)
  40. Locate 11,3 : Print Border$(Zone$("COOL TEXT",3),1)
  41. Locate 29,3 : Print Border$(Zone$("ALL CAPS",8),1)
  42. Locate 39,3 : Print Border$(Zone$("LOWER CASE",9),1)
  43. Locate 51,3 : Print Border$(Zone$("CYPHER",10),1)
  44. Locate 59,3 : Print Border$(Zone$("DE-CYPHER",11),1)
  45. Pen 5 : _PP
  46. KEE:
  47. While Mouse Key=0 : Wend 
  48. KK=Mouse Zone
  49. If FL=1 Then Goto PL
  50. If KK>1 and KK<>5 and KK<>7 Then Pen 3 : Locate 25,19 : Print "LOAD A TEXT FILE FIRST!" : Wait 60 : Pen 5 : Locate 25,19 : Print Space$(25) : Goto MEN
  51. PL:
  52. If KK=1 Then _LOAD
  53. If KK=3 and FL=1 Then _UPDOWN : _RAMSAVE : _RELOAD : Goto MEN
  54. If KK=4 and FL=1 Then _CLEAN : _RAMSAVE : _RELOAD : Goto MEN
  55. If KK=5 Then Erase 10 : Erase 11 : Stop 
  56. If KK=7 Then _HELP : Goto MEN
  57. If KK=8 and FL=1 Then _ALLCAPS : _RAMSAVE : _RELOAD : Goto MEN
  58. If KK=9 and FL=1 Then _ALLLOW : _RAMSAVE : _RELOAD : Goto MEN
  59. If KK=10 and FL=1 Then _CYPHER : _RAMSAVE : _RELOAD : Goto MEN
  60. If KK=11 and FL=1 Then _DECYPHER : _RAMSAVE : _RELOAD : Goto MEN
  61. If KK=12 and FL=1 Then _SHOW : Goto MEN
  62. If KK=13 and FL=1 Then _SAVE : Goto MEN
  63. Goto KEE
  64. '==================================
  65. Procedure _LOAD
  66.    Erase 10 : Erase 11
  67.    F$=Fsel$("","","LOAD A TEXT FILE","")
  68.    If F$="" Then FL=0 : Pop Proc
  69.    If Exist(F$)=0 Then FL=0 : Bell : Pop Proc
  70.    Open In 1,F$ : BL=Lof(1)
  71.    Reserve As Data 10,BL
  72.    Reserve As Data 11,BL
  73.    A$=Input$(1,BL)
  74. Close 1
  75.    Bload F$,10 : BS=Start(10) : BE=BS+BL-1
  76. FL=1
  77. _PP
  78. End Proc
  79. Procedure _OC
  80. Locate 33,23 : Print "OPERATION COMPLETED     " : Wait 100 : 
  81. Locate 33,23 : Print Space$(40)
  82. End Proc
  83. Procedure _SAVE
  84. Dir$="df0:"
  85.    F$=Fsel$("","","save File","")
  86.    If F$="" Then Pop Proc
  87.    Bsave F$,Start(11) To Start(11)+BL
  88. End Proc
  89. Procedure _CLEAN
  90. BE2=Start(11) : COUNT=0 : DEL=0 : FO=0 : NC=0
  91. For A=BS To BS+BL
  92. X=Peek(A)
  93. If X<>10 Then NC=0 : Goto DU
  94. If X=10 Then Inc NC
  95. If X=10 and NC=>2 Then Inc DEL : Goto GK
  96. DU:
  97. Poke BE2+COUNT,X
  98. GK:
  99. Inc COUNT
  100. Locate 33,23 : Print "CLEANING>";COUNT-2
  101. Next A
  102. Locate 33,23 : Print "DELETED ";DEL;" lines" : Wait 100
  103. _OC
  104. End Proc
  105. Procedure _PP
  106. Locate 0,21 : Print "FILE SPEC:";F$
  107. Locate 0,23 : Print "FILE LENGTH=";BL
  108. FR=Free
  109. Locate 0,25 : Print "CHIP MEM=";Chip Free;"     FAST MEM=";Fast Free;"     WORK SPACE FREE";FR
  110. End Proc
  111. Procedure _UPDOWN
  112. BE2=Start(11) : COUNT=0 : CAP=1
  113. For A=BS To BS+BL
  114. X=Peek(A)
  115. If CAP=1 and X>=97 and X<=122 Then X=X-32 : Goto DU
  116. If CAP=0 and X>=65 and X<=90 Then X=X+32
  117. DU:
  118. Poke BE2+COUNT,X : Inc COUNT
  119. If CAP=1 Then CAP=0 : Goto FD
  120. If CAP=0 Then CAP=1
  121. Locate 33,23 : Print "COOLING>";COUNT-2
  122. FD:
  123. Next A
  124. _OC
  125. End Proc
  126. Procedure _CYPHER
  127. BE2=Start(11) : COUNT=0
  128. For A=BS To BS+BL
  129. X=Peek(A)
  130. Inc X
  131. Inc X
  132. Inc X
  133. DU:
  134. Poke BE2+COUNT,X : Inc COUNT
  135. Locate 33,23 : Print "CYPHERING>";COUNT-2
  136. Next A
  137. _OC
  138. End Proc
  139. Procedure _DECYPHER
  140. BE2=Start(11) : COUNT=0
  141. For A=BS To BS+BL
  142. X=Peek(A)
  143. Dec X
  144. Dec X
  145. Dec X
  146. DU:
  147. Poke BE2+COUNT,X : Inc COUNT
  148. Locate 33,23 : Print "DE-CYPHERING>";COUNT-2
  149. Next A
  150. _OC
  151. End Proc
  152. Procedure _ALLCAPS
  153. BE2=Start(11) : COUNT=0
  154. For A=BS To BS+BL
  155. X=Peek(A)
  156. If X>=97 and X<=122 Then X=X-32
  157. DU:
  158. Poke BE2+COUNT,X : Inc COUNT
  159. Locate 33,23 : Print "CAPPING>";COUNT-2
  160. Next A
  161. _OC
  162. End Proc
  163. Procedure _ALLLOW
  164. BE2=Start(11) : COUNT=0
  165. For A=BS To BS+BL
  166. X=Peek(A)
  167. If X>=65 and X<=90 Then X=X+32
  168. DU:
  169. Poke BE2+COUNT,X : Inc COUNT
  170. Locate 33,23 : Print "LOWER CASING>";COUNT-2
  171. Next A
  172. _OC
  173. End Proc
  174. Procedure _STRIP
  175. BE2=Start(11) : COUNT=0 : DEL=0
  176. For A=BS To BS+BL
  177. X=Peek(A)
  178. If X>=33 and X<=127 Then Goto DU
  179. Inc DEL : Goto GK
  180. DU:
  181. Poke BE2+COUNT,X
  182. GK:
  183. Inc COUNT
  184. Locate 33,23 : Print "STRIPING>";COUNT-2
  185. Next A
  186. Locate 33,23 : Print "DELETED ";DEL;" CHARS" : Wait 100
  187. _OC
  188. End Proc
  189. Procedure _SHOW
  190. Cls : PAGE=0 : LIN=0
  191. For A=1 To BL
  192. R$=Mid$(A$,A,1)
  193. If Y Curs=>30 Then Vscroll 3 : Locate ,29
  194.    If X Curs=80-RMARGIN Then Locate LMARGIN,Y Curs+1
  195.    If Asc(R$)=9 Then Print Tab$; : Goto MORE
  196.    If Asc(R$)=10 Then Locate LMARGIN,Y Curs+1 : Inc LIN : Goto MORE
  197.    Print R$;
  198. MORE:
  199. If LIN>=25 Then Inc PAGE : Gosub UPD : LIN=0 : Home 
  200. Next A
  201. Gosub UPD
  202. Pop Proc
  203. UPD:
  204. Paper 2 : Pen 4 : Locate 0,27 : Print "PAGE:";PAGE;"  PRESS RIGHT MOUSE BUTTON CONTINUE OR LEFT MOUSE TO EXIT "
  205. Paper 0 : Pen 5 : Home : 
  206. J:
  207. While Mouse Key=0 : Wend 
  208. If Mouse Key=1 Then Pop Proc
  209. If Mouse Key=2 Then Cls 0 : Return 
  210. Goto J
  211. End Proc
  212. Procedure _HELP
  213. Cls 13 : Paper 13 : Pen 0 : Home 
  214. Under On : Pen 2 : Centre "CoOl TeXt V1.0   S.Bye Feb 1994" : Under Off 
  215. Print : Pen 5 : Print : Centre "This program is DISKWARE, If you like it or want to keep it"
  216. Print : Centre "then please send me a disk of good P.D utils/games."
  217. Print : Centre "The AMOS source code is available for just ï¿½3.00 a disk and SAE."
  218. Print 
  219. Pen 0 : Print : Centre " 1) First you must load A text file, click on LOAD to do this."
  220. Print : Print : Centre " 2) Click on VIEW to check it is the file you want to process."
  221. Print : Print : Centre " 3) You now have six options along the very top of the screen, which are:"
  222. Print 
  223. Print : Centre " 4) COOL TEXT, ThIs CoNvErTs ThE FiLe To ThIs FoRmAt, To ImPrEsS YoUr MaTeS."
  224. Print 
  225. Print : Centre " 5) CLEAN, This removes excess blank lines making long documents a lot"
  226. Print : Centre "   shorter, Cooltext scans for two or more blank lines consecutively and"
  227. Print : Centre "    deletes all but one, this can save reams of paper on P.D doc files etc."
  228. Print 
  229. Print : Centre " 6) ALL CAPS, Converts all the text to capital letters."
  230. Print 
  231. Print : Centre " 7) LOWER CASE, Converts all the text to Lower case letters."
  232. Print 
  233. Print : Centre " 8) CYPHER, Encodes a text file so as to be unreadable in normal circumstances."
  234. Print 
  235. Print : Centre "9) DE-CYPHER, Decodes a Cyphered file back to normal."
  236. Print : Print : Centre "10) SAVE, is fairly obvious, click on this to SAVE your processed file to disk."
  237. Print : Print : Inverse On : Centre "Steve Bye, 31 Wellington rd, Exeter, Devon.  EX2-9DU" : Inverse Off 
  238. '
  239. '
  240. Pen 3 : Print : Print : Centre "press a mouse key"
  241. While Mouse Key=0 : Wend 
  242. Pen 0
  243. End Proc
  244. Procedure _RAMSAVE
  245. Dir$="RAM:" : F$="text.txt"
  246. Bsave F$,Start(11) To Start(11)+BL
  247. End Proc
  248. Procedure _RELOAD
  249. Erase 10
  250. Erase 11
  251. Dir$="RAM:"
  252. Open In 1,F$ : BL=Lof(1)
  253.    Reserve As Data 10,BL
  254.    Reserve As Data 11,BL
  255.    A$=Input$(1,BL)
  256. Close 1
  257.    Bload F$,10 : BS=Start(10) : BE=BS+BL-1
  258. Locate 0,21 : Print F$ : FL=1
  259. Locate 0,22 : Print "length=";BL
  260. Kill F$
  261. End Proc
  262. Procedure _RAINING
  263. Set Rainbow 2,0,100,"","","(9,1,1)" : Rainbow 2,0,46,100
  264. Set Rainbow 1,0,30,"(3,1,1)","","" : Rainbow 1,0,175,30
  265. End Proc